/*!
\file Container.h
\brief Contains declaration of Container.
\ingroup Algorithm
*/

#ifndef CONTAINER_H
#define CONTAINER_H

class ContainerElement;
class ContainerElementAction;

#include<QObject>
#include<QList>

//Reimplementation of a standard list type. Necessary for data substraction from algorithms. The most elementary functions have been provided. See documentation of ContainerElement for more information.

/*!
\class Container
\brief Reimplementation of a standard list type.
This class is necessary for data substraction from Algorithms. The most elementary list functions have been provided. See documentation of ContainerElement for more information.
\ingroup Algorithm
*/

class Container:public QObject{
Q_OBJECT
public:
	Container();
	//!< Constructor. Creates an empty Container.
	~Container();
	//!< Destructor.
	Container( const Container &other );
	//!< Copy constructor. \warning Should never be used.
	
	void push_front( ContainerElement *element );
	//!< Add element to the front of list.
	void push_back( ContainerElement *element );
	//!< Add element to the end of list.
	void pop_front();
	//!< Remove first element.
	void pop_back();
	//!< Remove last element.
	
	unsigned int size()const{ return m_container.size(); }
	//!< Reports amount of elements in this Container.
	
	ContainerElement *operator[]( unsigned int i ){ return m_container.operator[](i); }
	//!< Returns i'th ContainerElement.
	ContainerElement *takeAt(unsigned int i);
	//!< Removes i'th ContainerElement and returns it.
	
	Container &operator=( const Container &/*other*/ ){ return *this; }
	//!< Assignment operator. \warning Should never be used.
private slots:
	void _reportChild( ContainerElementAction *action );
private:
	void _report( ContainerElementAction *action );
	void _reportNewElement( ContainerElement *element, int seqNum );
	QList<ContainerElement*> m_container;
signals:
	void reportAction(ContainerElementAction*);
	//!< Report a change to ContainerVisualizer.
};


#endif
